<?php

declare(strict_types=1);

namespace App\Model\Users;

use App\Model\Model;
use App\Traits\Model\Users\Payer as PayerTraits;
use Hyperf\Database\Model\SoftDeletes;

/**
 * @property int $id
 * @property int $user_id 用户ID
 * @property string $openid 微信OPENID
 * @property string $name 姓名
 * @property string $id_card 身份证号码
 * @property string $mobile 手机号码
 * @property string $front_img 身份证正面
 * @property string $back_img 身份证反面
 * @property string $hand_front_img 手持身份证正面
 * @property string $hand_back_img 手持身份证反面
 * @property int $is_default 是否默认
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at
 * @property string $deleted_at
 */
class Payer extends Model
{
    use PayerTraits, SoftDeletes;

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'payer';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = [
        'id',
        'user_id',
        'openid',
        'name',
        'id_card',
        'mobile',
        'front_img',
        'back_img',
        'hand_front_img',
        'hand_back_img',
        'is_default',
        'created_at',
        'updated_at',
        'deleted_at'
    ];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'is_default' => 'boolean', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    /**
     * 自动新增
     * @var array|string[]
     */
    public array $insert = [
        'user_id',
        'openid'
    ];
}
